package cn.shengongying.service.impl;

import cn.shengongying.model.UserPositionApplyRecord;
import cn.shengongying.dao.UserPositionApplyRecordMapper;
import cn.shengongying.service.IUserPositionApplyRecordService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 用户申请职位记录 服务实现类
 * </p>
 *
 * @author RXK
 * @since 2022-01-10
 */
@Service
public class UserPositionApplyRecordServiceImpl extends ServiceImpl<UserPositionApplyRecordMapper, UserPositionApplyRecord> implements IUserPositionApplyRecordService {


    private final UserPositionApplyRecordMapper positionApplyRecordMapper;

    public UserPositionApplyRecordServiceImpl(UserPositionApplyRecordMapper positionApplyRecordMapper) {
        this.positionApplyRecordMapper = positionApplyRecordMapper;
    }

    @Override
    public List<UserPositionApplyRecord> findByBossIdAndPositionIdPage(Long userId, Long positionId, Integer type) {
        return positionApplyRecordMapper.findByBossIdAndPositionId(userId,positionId,type);
    }

    @Override
    public List<UserPositionApplyRecord> findByPositionIdAndStatus(Long positionId, int status) {
        return positionApplyRecordMapper.selectList(new LambdaQueryWrapper<UserPositionApplyRecord>().eq(UserPositionApplyRecord::getPositionId,positionId).eq(UserPositionApplyRecord::getStatus,status));
    }

    @Override
    public List<UserPositionApplyRecord> userApplyRecord(List<Long> userId, Long positionId, int status) {
        return positionApplyRecordMapper.selectList(new LambdaQueryWrapper<UserPositionApplyRecord>().in(UserPositionApplyRecord::getUserId,userId).eq(UserPositionApplyRecord::getPositionId,positionId).eq(UserPositionApplyRecord::getStatus,status));
    }

}
